import type { FC } from 'react';
import classNames from 'classnames';
import { LoadingOutlined } from '@ant-design/icons';
import styles from './styles.module.less';

interface IProps {
  tip?: string;
  maxContent?: boolean;
  fullscreen?: boolean;
}

const Loading: FC<IProps> = (props) => {
  const {
    tip,
    fullscreen,
    maxContent
  } = props;

  const wrapperClass = classNames(
    fullscreen && styles.fullscreen,
    maxContent && styles.max_content
  );
  
  return (
    <div className={wrapperClass}>
      <div className={styles.loading_el}>
        <LoadingOutlined />
        <span className={styles.loading_tip}>
          {tip || '加载中..'}
        </span>
      </div>
    </div>
  )
}

export default Loading;